package com.fsxgt.datagrid.console.config;

import javax.servlet.http.HttpServletRequest;

import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;

import com.fsxgt.datagrid.sys.bo.LoginBO;

@Component
public class PermissionHandler{


	public boolean hasPermission(HttpServletRequest request, Authentication authentication) {

		Object principal = authentication.getPrincipal();

		boolean hasPermission = false;

		if (principal instanceof LoginBO) {
			// 读取用户所拥有的权限菜单
			String userType=((LoginBO)principal).getSysUserBO().getUserType();
			if(userType!=null&&userType.equals("2")) {
				return true;
			}
		}

		return hasPermission;

	}

}